// mircoApp/love_release_bonu/love_release_bonu.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    background_color: "#f15353",
    statsitic: [],
    listarr: [],
    isshow: false, //判断二维码的显示
    store_alone_temp: 0, // 门店独立参数
    showcarrfootBol: false,
    iPnoneBottomBol: false,

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    const yz_basic_info = wx.getStorageSync('yz_basic_info');
    if (yz_basic_info.theme_color) {
      this.setData({
        background_color: yz_basic_info.theme_color
      })
    }
    this.getData();
    this.getiPnoneBottom();
  },
  getiPnoneBottom() {
    try {
      var value = wx.getStorageSync("iPhoneBottom");
      if (value) {
        this.setData({
          iPnoneBottomBol: true,
        });
      }
    } catch (e) {
      // Do something when catch error
    }
  },
  toUrls(e) {
    let {
      key
    } = e.currentTarget.dataset;
    if (key == 'myRelationship') {
      wx.navigateTo({
        url: '/packageD/member/myRelationship/myRelationship',
      })
    } else if (key == 'shopsLove') {
      wx.navigateTo({
        url: '/mircoApp/shopsProfits/shopsLove/shopsLove',
      })
    } else {
      this.openQrCode();
    }
  },
  openQrCode(){
    this.openQrCode();
  },
  openQrCode(e) {
    this.setData({
      isshow: true,
    });
  },
  getData() {
    let urlStr = app.getNetAddresss("plugin.love-release-bonus.frontend.controllers.center.index");
    app._getNetWork({
      url: urlStr,
      success: (response) => {
        let res = response.data;
        if (res.result === 1) {
          this.setData({
            listarr: res.data.list,
            statsitic: res.data.statsitic
          })
        } else {
          wx.showToast({
            title: res.msg,
            icon: 'none',
            duration: 2000
          });
        }
      },
      fail: function (res) {
        console.log(res);
      }
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})